<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>箭头函数使用2</title>
    <script type="text/javascript">
    //传统
    var f1 = function(n, m) {
      var res = 0;
      for (let i = 0; i <= m; i++) {
        res += i;
      }
      return res
    }
    console.log("传统=" + f1(1, 10))

    //ES6
    let f2 = (n, m) => {
      var res = 0;
      for (let i = 0; i <= m; i++) {
        res += i;
      }
      return res
    }

    </script>
  </head>
  <body>

  </body>
</html>